{% extends 'base.html' %}

{% block htmlhead %}
    {% load html_tools %}
    {{ 'minivideo/minivideo.css' | as_css }}
{% endblock %}

{% block content %}
<div class="central">
{% if flag %}

    {% load permission_check %}
    {% if perms.minivideo.manager %}
    <!-- 审核start -->
    <div class="resource_info">
        <p>队长姓名: {{ resource.team_captain }}</p>
        <p>队长学号: {{ resource.team_captain_stuno }}</p>
        <p>队长学院: {{ resource.team_captain_college }}</p>
        <p>队长电话: {{ resource.team_captain_phone }}</p>
        <p><span>队员1: {{ resource.team_members1_name }}</span><span>学号: {{ resource.team_members1_id }}</span></p>
        <p><span>队员2: {{ resource.team_members2_name }}</span><span>学号: {{ resource.team_members2_id }}</span></p>
        <p><span>队员3: {{ resource.team_members3_name }}</span><span>学号: {{ resource.team_members3_id }}</span></p>
        <p><span>队员4: {{ resource.team_members4_name }}</span><span>学号: {{ resource.team_members4_id }}</span></p>
        <p><span>队员5: {{ resource.team_members5_name }}</span><span>学号: {{ resource.team_members5_id }}</span></p>

        {% if resource.video_cover %}
        <p>视频封面: <a href="{{ resource.video_cover.url }}" target="_blank">点击查看</a></p>
        {% else %}
        <p>视频封面: </p>
        {% endif %}

        <p>视频名字: {{ resource.video_name }}</p>
        <p>视频简介: {{ resource.video_intro }}</p>

        {% if resource.video_link %}
        <p>视频链接: <a href="{{ resource.video_link }}" target="_blank">点击观看</a></p>
        {% else %}
        <p>视频链接: </p>
        {% endif %}

        <p>投票数: {{ resource.votes }}</p>
        {% if resource.has_verified %}
        <p>审核状态: 已审核</p>
        {% else %}
        <p>审核状态: 未审核</p>
        {% endif %}
    </div>   

    <a class="verify" href="{% url 'minivideo:verify' %}?id={{resource.id}}">
        {% if resource.has_verified %}
        设为未审核
        {% else %}
        通过审核
        {% endif %}
    </a>
    <!-- 审核end -->
    {% else %}
    <!-- 提交表单start -->
    <div class="minivideo_form">
        <h2>参赛作品提交表</h2>
        <div class="hint_con">
            <p class="hint" >温馨提示:</p>
            <p class="hint">1.请在参赛视频的前面加上本次大赛片头 <a href="">片头下载</a></p>
            <p class="hint">2.请将视频上传至优酷后提交网址，如：http://v.youku.com/v_show/id_XNDU2NzE2MA==.html</p>
            <p class="hint">3.提交或者重新提交后都需接受审核，审核通过才会显示在首页</p>
            <p class="hint">4.为了更好的显示效果，视频封面宽度建议为300-500px</p>
        </div>
        <form enctype="multipart/form-data" method="post" action="" >
        {% csrf_token %}
            <p style="display:none">{{ form.team_captain_stuno }}</p>

            <p><span>视频封面</span><span>{{ form.video_cover }}</span></p>
            <span class="error">
            {% for error in form.video_cover.errors %}
                {{ error }}
            {% endfor %}
            </span>

            <p><span>视频名字</span><span>{{ form.video_name }}</span></p>
            <span class="error">
            {% for error in form.video_name.errors %}
                {{ error }}
            {% endfor %}
            </span>

            <p><span>视频链接</span><span>{{ form.video_link }}</span></p>
            <span class="error">
            {% for error in form.video_link.errors %}
                {{ error }}
            {% endfor %}
            </span>

            <p><span>视频简介</span><span>{{ form.video_intro }}</span></p>
            <span class="error">
            {% for error in form.video_intro.errors %}
                {{ error }}
            {% endfor %}
            </span>

            <p><span>密码</span><span>{{ form.confirm }}</span></p>
            <span class="error">
            {% for error in form.confirm.errors %}
                {{ error }}
            {% endfor %}
            </span>

            <p style="text-align: center;"><input class="form_btn" type="submit" value="提交" /></p>
        </form>
        
    </div>
    <!-- 提交表单end -->
    {% endif %}

{% else %}

    <!-- 报名表单start -->
    <div class="minivideo_form">
        <h2>参赛者报名表</h2>
        <div class="hint_con">
            <p class="hint">温馨提示:</p>
            <p class="hint">队员无需填满，根据队伍人数而定；请牢记队伍密码</p>
        </div>
        <form method="post" action="" >
        {% csrf_token %}
            <p><span>队长姓名</span><span>{{ form.team_captain }}</span></p>
            <span class="error">
            {% for error in form.team_captain.errors %}
                {{ error }}
            {% endfor %}
            </span>

            <p><span>队长学号</span><span>{{ form.team_captain_stuno }}</span></p>
            <span class="error">
            {% for error in form.team_captain_stuno.errors %}
                {{ error }}
            {% endfor %}
            </span>

            <p><span>队长学院</span><span>{{ form.team_captain_college }}</span></p>
            <span class="error">
            {% for error in form.team_captain_college.errors %}
                {{ error }}
            {% endfor %}
            </span>
                   
            <p><span>队长电话</span><span>{{ form.team_captain_phone }}</span></p>
            <p><span>建议长号短号都留下，用空格隔开</span></p>
            <span class="error">
            {% for error in form.team_captain_phone.errors %}
                {{ error }}
            {% endfor %}
            </span>
                                                
            <p><span>队员姓名</span><span>{{ form.team_members1_name }}</span></p>
            <span class="error">
            {% for error in form.team_members1_name.errors %}
                {{ error }}
            {% endfor %}
            </span>

            <p><span>队员学号</span><span>{{ form.team_members1_id }}</span></p>
            <span class="error">
            {% for error in form.team_members1_id.errors %}
                {{ error }}
            {% endfor %}
            </span>

            <p><span>队员姓名</span><span>{{ form.team_members2_name }}</span></p>
            <span class="error">
            {% for error in form.team_members2_name.errors %}
                {{ error }}
            {% endfor %}
            </span>

            <p><span>队员学号</span><span>{{ form.team_members2_id }}</span></p>
            <span class="error">
            {% for error in form.team_members2_id.errors %}
                {{ error }}
            {% endfor %}
            </span>

            <p><span>队员姓名</span><span>{{ form.team_members3_name }}</span></p>
            <span class="error">
            {% for error in form.team_members3_name.errors %}
                {{ error }}
            {% endfor %}
            </span>

            <p><span>队员学号</span><span>{{ form.team_members3_id }}</span></p>
            <span class="error">
            {% for error in form.team_members3_id.errors %}
                {{ error }}
            {% endfor %}
            </span>

            <p><span>队员姓名</span><span>{{ form.team_members4_name }}</span></p>
            <span class="error">
            {% for error in form.team_members4_name.errors %}
                {{ error }}
            {% endfor %}
            </span>

            <p><span>队员学号</span><span>{{ form.team_members4_id }}</span></p>
            <span class="error">
            {% for error in form.team_members4_id.errors %}
                {{ error }}
            {% endfor %}
            </span>

            <p><span>队员姓名</span><span>{{ form.team_members5_name }}</span></p>
            <span class="error">
            {% for error in form.team_members5_name.errors %}
                {{ error }}
            {% endfor %}
            </span>

            <p><span>队员学号</span><span>{{ form.team_members5_id }}</span></p>
            <span class="error">
            {% for error in form.team_members5_id.errors %}
                {{ error }}
            {% endfor %}
            </span>
                        
            <p><span>设置队伍密码</span><span>{{ form.team_psw }}</span></p>
            <span class="error">
            {% for error in form.team_psw.errors %}
                {{ error }}
            {% endfor %}
            </span>
                        
            <p><span>密码确认</span><span>{{ form.confirm }}</span></p>
            <span class="error">
            {% for error in form.confirm.errors %}
                {{ error }}
            {% endfor %}
            </span>

            <p style="text-align: center;"><input class="form_btn" type="submit" value="提交" /></p>
        </form>
    </div>
    <!-- 报名表单end -->

{% endif %}
</div>
{% endblock %}